package com.wufeng.spring02_ioc;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringConfig {

    @Bean
    public FunctionService getFunctionService() {
        return new FunctionService();
    }

    @Bean
    public UseFunctionService getUseFunctionService() {
        // 构造方法注入
//        return new UseFunctionService(getFunctionService());
        // set方法注入
        UseFunctionService useFunctionService = new UseFunctionService();
        useFunctionService.setFunctionService(getFunctionService());
        return useFunctionService;
    }
}
